﻿<%@ Page Title="" Language="C#" MasterPageFile="~/EasyUI.Master" AutoEventWireup="true" CodeBehind="mylist.aspx.cs" Inherits="jnxc.Web.addprevention.mylist" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">   
    <script src="../Script/username.js"></script>
    <script src="../Script/datetime.js"></script>
    <script src="../Script/export.js"></script>
    <script type="text/javascript">
        $.extend($.fn.tree.methods, {
            getLevel: function (jq, target) {
                var l = $(target).parentsUntil("ul.tree", "ul");
                return l.length + 1;
            }
        });
        $(function () {
            InitGird();
            InitTree();
            $('#aid').combobox({
                url: '../areainfo/GetArea.ashx?action=ddllist',
                valueField: 'aid',
                textField: 'aname',
                panelHeight: 'auto',
                editable: false,
                onLoadSuccess: function () {
                    var data = $('#aid').combobox('getData');
                    $("#aid").combobox('select', data[0].caid);
                }
            });
            $('#dpid').combobox({
                url: '../dpinfo/GetDP.ashx?action=ddllist',
                valueField: 'dpid',
                textField: 'dpname',
                panelHeight: 'auto',
                editable: false,
                onLoadSuccess: function () {
                    var data = $('#dpid').combobox('getData');
                    $("#dpid").combobox('select', data[0].caid);
                }
            });
        });
        function InitTree() {
            $('#pt').tree({
                url: 'GetADD.ashx', //请求数据的页面               
                width: '100%', //宽度                
                lines: true,
                method: 'post',
                queryParams: { "action": "queryt" },
                onClick: function (node) {
                    if (node.text != "") {	                    
                                
                        $('#idstr').val(node.id);
                        $('#otype').val(node.type);
                                reloadgrid(); 
                    }
                },
                onLoadSuccess: function (node, param) {
                    
                    $('#pt').tree("collapseAll");
                    var node = $('#pt').tree("getRoot");
                    $('#pt').tree("expand", node.target);
                }
            });
        }
        //初始化表格
        function InitGird() {
            $('#tt').datagrid({
                title: '防治列表', //表格标题
                url: 'GetADD.ashx', //请求数据的页面
                sortName: 'fztime', //排序字段
                idField: 'apid', //标识字段,主键
                iconCls: '', //标题左边的图标
                width: '100%', //宽度
               // height: $(parent.document).find("#mainPanle").height() - 35 > 0 ? $(parent.document).find("#mainPanle").height() - 35 : 500, //高度
                nowrap: false, //是否换行，True 就会把数据显示在一行里
                striped: true, //True 奇偶行使用不同背景色
                collapsible: false, //可折叠
                sortOrder: 'desc', //排序类型
                remoteSort: true, //定义是否从服务器给数据排序
                //fitColumns: true,
                singleSelect: true,
                method: 'post',
                frozenColumns: [[
                    //{ field: 'ckb', checkbox: true },
                    { title: '区域代码', field: 'abh', sortable: true,width:80 },
                    { title: '区域名称', field: 'aname', width: 80 },
                    { title: '病虫名称', field: 'hname', width: 80 },
                    { title: '寄主树种', field: 'trees', width: 80 }
                ]],
                columns: [[		
                    { title: '应监面积', field: 'shouldarea', width: 80 },
                    { title: '寄主面积', field: 'jzarea', width: 80 },
                    { title: '监测面积', field: 'jcarea', width: 80 },
                    { title: '世代、次', field: 'generation', width: 80 },
                    {
                        title: '调查时间', field: 'dctime', formatter: function (value, row, index) {
                            if (value != "") {

                                if (value.indexOf("-") != -1)
                                    value = value.replace(/-/g, "/")
                                return new Date(value).pattern("yyyy年M月d日");
                            }
                        }, width: 80
                    },
                    { title: '低虫口低感病面积', field: 'dckdgarea', width: 80 },
                    { title: '分布面积', field: 'fbarea', width: 80 },
                    { title: '世代累计发生面积', field: 'sdlj', width: 80 },
                    { title: '累计轻度', field: 'ljqd', width: 80 },
                    { title: '累计中度', field: 'ljzd', width: 80 },
                    { title: '发生合计', field: 'fssum', width: 80 },
                    { title: '发生轻度', field: 'fsqd', width: 80 },
                    { title: '发生中度', field: 'fszd', width: 80 },
                    { title: '发生重度', field: 'fszzd', width: 80 },
                    { title: '同病虫新发生', field: 'tbcnew', width: 80 },
                    { title: '预计灾害面积', field: 'yjzh', width: 80 },
                    { title: '发生率', field: 'fsrate', width: 80 },
                   
                    {
                        title: '防治时间', field: 'fztime',  formatter: function (value, row, index) {
                            if (value != "") {
                                if (value.indexOf("-") != -1)
                                    value = value.replace(/-/g, "/")
                                return new Date(value).pattern("yyyy年M月d日");
                            }
                        }, width: 80
                    },
                     { title: '作业面积合计', field: 'workarea', width: 80 },
                    { title: '无公害作业面积合计', field: 'wghwork', width: 80 },
                    { title: '真菌', field: 'zja', width: 80 },
                    { title: '细菌', field: 'xja', width: 80 },
                    { title: '病毒', field: 'bda', width: 80 },
                    { title: '蜂类', field: 'fla', width: 80 },
                    { title: '其它天敌', field: 'qttda', width: 80 },
                    { title: '植物源药剂', field: 'zwyyja', width: 80 },
                    { title: '其它生防', field: 'fsfza', width: 80 },
                    { title: '无公害化防', field: 'wghhfa', width: 80 },
                    { title: '物理防治', field: 'wlfza', width: 80 },
                    { title: '人工防治', field: 'qtfza', width: 80 },
                    { title: '其它防治', field: 'qtfza', width: 80 },
                    { title: '其它无公害', field: 'qtwgha', width: 80 },
                    { title: '化学防治', field: 'hxfza', width: 80 },
                    { title: '防治面积合计', field: 'fzsum', width: 80 },
                    { title: '预防面积', field: 'yfarea', width: 80 },
                    
                    { title: '飞防面积', field: 'ffarea', width: 80 },
                     { title: '真菌', field: 'zjb', width: 80 },
                    { title: '细菌', field: 'xjb', width: 80 },
                    { title: '病毒', field: 'bdb', width: 80 },
                    { title: '蜂类', field: 'flb', width: 80 },
                    { title: '其它天敌', field: 'qttdb', width: 80 },
                    { title: '其它生防', field: 'qtsfb', width: 80 },
                    { title: '防生', field: 'fsb', width: 80 },
                    { title: '人工', field: 'rgb', width: 80 },
                    { title: '其它防治', field: 'qtfzb', width: 80 },
                    { title: '化防', field: 'hfb', width: 80 },
                    { title: '同病虫新防治', field: 'tbcxfz', width: 80 },
                    { title: '无公害防治率', field: 'wghfzrate', width: 80 },
                    { title: '防治率', field: 'fzrate', width: 80 },
                    { title: '成灾面积', field: 'czarea', width: 80 },
                    { title: '挽回灾害面积', field: 'whzharea', width: 80 },
                    { title: '成灾率', field: 'czrate', width: 80 },
                    { title: '防治费用', field: 'fzfy', width: 80 },
                    { title: '死树株数', field: 'sszs', width: 80 },
                    { title: '真菌量', field: 'zjl', width: 80 },
                    { title: '细菌量', field: 'xjl', width: 80 },
                    { title: '病毒量', field: 'bdl', width: 80 },
                    { title: '天敌昆虫（万头）', field: 'tdkc', width: 80 },
                    { title: '防生用量', field: 'fsyl', width: 80 },
                    { title: '有机磷量', field: 'yjll', width: 80 },
                    { title: '菊脂类量', field: 'jzll', width: 80 },
                    { title: '烟剂量', field: 'yjl', width: 80 },
                    { title: '化学其它', field: 'hxqt', width: 80 }                    
                ]],
                toolbar: "#tab_toolbar",
                queryParams: { "action": "querymy" },
                pagination: true, //是否开启分页
                pageNumber: 1, //默认索引页
                pageSize: 20, //默认一页数据条数
                rownumbers: true //行号
            });


        }	   	   
        //修改管理员  
        function showData() {

            var row = $('#tt').datagrid('getSelected');
            if (row == null) {
                $.messager.alert("提示", "请选择要修改的行！", "info");
            }
            if (row) {
                $('#dlg').dialog('open').dialog('setTitle', '防治信息');	           
                $('#fm').form('load', row);
            }
        }
        //添加    
        
        function getQueryParams(queryParams) {
            var StartTime = $("#StartTime").datebox("getValue");
            var EndTime = $("#EndTime").datebox("getValue");
            var idstr = $("#idstr").val();
            //var otype = document.getElementById("otype").value;
            var otype = $("#otype").val();
            queryParams.StartTime = StartTime;
            queryParams.EndTime = EndTime;
            queryParams.idstr = idstr;
            queryParams.otype = otype;

            return queryParams;

        }
        //增加查询参数，重新加载表格  
        function reloadgrid() {

            //查询参数直接添加在queryParams中      
            var queryParams = $('#tt').datagrid('options').queryParams;
            getQueryParams(queryParams);
            $('#tt').datagrid('options').queryParams = queryParams;
            $("#tt").datagrid('reload');

        }

    </script>
    <style type="text/css">
        .fitem {
            width:210px;
            float:left;
        }
            .fitem label {
                width:120px;
                line-height:22px;
            }
            .fitem input {
                width:80px;
            }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <div class="easyui-layout" style="width:100%; height:100%;" id="mycon">
        <div region="west" split="true" title="病虫地区检索" style="width: 180px;overflow:scroll" id="west">
            <ul id="pt"></ul>
            
        </div>
        <div region="center" style="background: #eee; overflow-y: hidden">
            <table id="tt">
            </table>
        </div>
    <div id="tab_toolbar" style="padding: 4px;">
        <table cellpadding="0" cellspacing="0" style="width: 100%">
            <tr>

                <td style="padding-left: 2px">
<div>  
           时间从:  
           <input id="StartTime" class ="easyui-datebox" style="width: 150px" />  
           到:  
           <input id="EndTime" class="easyui-datebox" style="width: 150px" />   
          名称:   
           <input id="mname" class="easyui-validatebox"/>   
           
           <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-search'" onclick="reloadgrid()">查找</a> 
    <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-save'" onclick="Export('excel', $('#tt'));">导出</a> 
       </div>            

                    
                </td>
            </tr>
        </table>

    </div>
    <div id="dlg" class="easyui-dialog" style="width:930px; height:500px;overflow:auto; padding: 10px 20px"
        data-options="closed:true,buttons:'#dlg-buttons',shadow:false,resizable: true,maximizable:true,">
        <form id="fm" method="post">
            <div class="fitem">
                <label>区划名称：</label>
                <input id="aid" name="aid" class="easyui-combobox" data-options="required:true" />
            </div>
            <div class="fitem">
                <label>寄主树种：</label>
                <input id="trees" name="trees" class="easyui-validatebox" data-options="required:true" />
            </div>
            <div class="fitem">
                <label>应监面积：</label>
                <input id="shouldarea" name="shouldarea" class="easyui-validatebox" data-options="validType:'floatOrInt'" />
            </div>
            <div class="fitem">
                <label>病虫名称：</label>
                <input id="dpid" name="dpid" class="easyui-combobox" data-options="required:true" />
            </div>
            <div class="fitem">
                <label>寄主面积：</label>
                <input id="jzarea" name="jzarea" class="easyui-validatebox" data-options="validType:'floatOrInt'" />
            </div>
            <div class="fitem">
                <label>监测面积：</label>
                <input id="jcarea" name="jcarea" class="easyui-validatebox" data-options="validType:'floatOrInt'" />
            </div>
            <div class="fitem">
                <label>世代、次：</label>
                <input id="generation" name="generation" class="easyui-validatebox" data-options="required:true,validType:'number'" />
            </div>
            <div class="fitem">
                <label>调查时间：</label>
                <input id="dctime" name="dctime" class="easyui-datebox" data-options="required:true" />
            </div>
            <div class="fitem">
                <label>低虫口低感病面积：</label>
                <input id="dckdgarea" name="dckdgarea" class="easyui-validatebox" data-options="validType:'floatOrInt'" />
            </div>
            <div class="fitem">
                <label>分布面积：</label>
                <input id="fbarea" name="fbarea" class="easyui-validatebox" data-options="validType:'floatOrInt'" />
            </div>
            <div class="fitem">
                <label>世代累计发生面积：</label>
                <input id="sdlj" name="sdlj" class="easyui-validatebox" data-options="validType:'floatOrInt'" />
            </div>
            <div class="fitem">
                <label>累计轻度：</label>
                <input id="ljqd" name="ljqd" class="easyui-validatebox" data-options="validType:'floatOrInt'" />
            </div>
            <div class="fitem">
                <label>累计中度：</label>
                <input id="ljzd" name="ljzd" class="easyui-validatebox" data-options="validType:'floatOrInt'" />
            </div>
             <div class="fitem">
                <label>累计重度：</label>
                <input id="ljzzd" name="ljzzd" class="easyui-validatebox" data-options="validType:'floatOrInt'" />
            </div>
             <div class="fitem">
                <label>发生合计：</label>
                <input id="fssum" name="fssum" class="easyui-validatebox" data-options="validType:'floatOrInt'" />

            </div>
             <div class="fitem">
                <label>发生轻度：</label>
                <input id="fsqd" name="fsqd" class="easyui-validatebox" data-options="validType:'floatOrInt'" />
            </div>
             <div class="fitem">
                <label>发生中度：</label>
                <input id="fszd" name="fszd" class="easyui-validatebox" data-options="validType:'floatOrInt'" />
            </div>
             <div class="fitem">
                <label>发生重度：</label>
                <input id="fszzd" name="fszzd" class="easyui-validatebox" data-options="validType:'floatOrInt'" />
            </div>
             <div class="fitem">
                <label>同病虫新发生：</label>
                <input id="tbcnew" name="tbcnew" class="easyui-validatebox" data-options="validType:'floatOrInt'" />
            </div>
             <div class="fitem">
                <label>预计灾害面积：</label>
                <input id="yjzh" name="yjzh" class="easyui-validatebox" data-options="validType:'floatOrInt'" />
            </div>
             <div class="fitem">
                <label>发生率：</label>
                <input id="fsrate" name="fsrate" class="easyui-validatebox" data-options="validType:'floatOrInt'" />
            </div>
             <div class="fitem">
                <label>防治时间：</label>
                <input id="fztime" name="fztime" class="easyui-datebox" data-options="required:true" />
            </div>
             <div class="fitem">
                <label>作业面积合计：</label>
                <input id="workarea" name="workarea" class="easyui-validatebox" data-options="validType:'floatOrInt'" />
            </div>
             <div class="fitem">
                <label>无公害作业面积合计：</label>
                <input id="wghwork" name="wghwork" class="easyui-validatebox" data-options="validType:'floatOrInt'" />
            </div>
             <div class="fitem">
                <label>真菌：</label>
                <input id="zja" name="zja" class="easyui-validatebox" data-options="validType:'floatOrInt'" />
            </div>
            <div class="fitem">
                <label>细菌：</label>
                <input id="xja" name="xja" class="easyui-validatebox" data-options="validType:'floatOrInt'" />
            </div>
            <div class="fitem">
                <label>病毒：</label>
                <input id="bda" name="bda" class="easyui-validatebox" data-options="validType:'floatOrInt'" />
            </div>
            <div class="fitem">
                <label>蜂类：</label>
                <input id="fla" name="fla" class="easyui-validatebox" data-options="validType:'floatOrInt'" />
            </div>
            <div class="fitem">
                <label>其它天敌：</label>
                <input id="qttda" name="qttda" class="easyui-validatebox" data-options="validType:'floatOrInt'" />
            </div>
            <div class="fitem">
                <label>植物源药剂：</label>
                <input id="zwyyja" name="zwyyja" class="easyui-validatebox" data-options="validType:'floatOrInt'" />
            </div>
            <div class="fitem">
                <label>其它生防：</label>
                <input id="qtsfa" name="qtsfa" class="easyui-validatebox" data-options="validType:'floatOrInt'" />
            </div>
            <div class="fitem">
                <label>防生防治：</label>
                <input id="fsfza" name="fsfza" class="easyui-validatebox" data-options="validType:'floatOrInt'" />
            </div>
            <div class="fitem">
                <label>无公害化防：</label>
                <input id="wghhfa" name="wghhfa" class="easyui-validatebox" data-options="validType:'floatOrInt'" />
            </div>
            <div class="fitem">
                <label>物理防治：</label>
                <input id="wlfza" name="wlfza" class="easyui-validatebox" data-options="validType:'floatOrInt'" />
            </div>
            <div class="fitem">
                <label>人工防治：</label>
                <input id="rgfza" name="rgfza" class="easyui-validatebox" data-options="validType:'floatOrInt'" />
            </div>
            <div class="fitem">
                <label>其它防治：</label>
                <input id="qtfza" name="qtfza" class="easyui-validatebox" data-options="validType:'floatOrInt'" />
            </div>
            <div class="fitem">
                <label>其它无公害：</label>
                <input id="qtwgha" name="qtwgha" class="easyui-validatebox" data-options="validType:'floatOrInt'" />
            </div>
            <div class="fitem">
                <label>化学防治：</label>
                <input id="hxfza" name="hxfza" class="easyui-validatebox" data-options="validType:'floatOrInt'" />
            </div>
             <div class="fitem">
                <label>防治面积合计：</label>
                <input id="fzsum" name="fzsum" class="easyui-validatebox" data-options="validType:'floatOrInt'" />
            </div>
             <div class="fitem">
                <label>预防面积：</label>
                <input id="yfarea" name="yfarea" class="easyui-validatebox" data-options="validType:'floatOrInt'" />
            </div>
             <div class="fitem">
                <label>飞防面积：</label>
                <input id="ffarea" name="ffarea" class="easyui-validatebox" data-options="validType:'floatOrInt'" />
            </div>
             <div class="fitem">
                <label>真菌：</label>
                <input id="zjb" name="zjb" class="easyui-validatebox" data-options="validType:'floatOrInt'" />
            </div>
             <div class="fitem">
                <label>细菌：</label>
                <input id="xjb" name="xjb" class="easyui-validatebox" data-options="validType:'floatOrInt'" />
            </div>
             <div class="fitem">
                <label>病毒：</label>
                <input id="bdb" name="bdb" class="easyui-validatebox" data-options="validType:'floatOrInt'" />
            </div>
             <div class="fitem">
                <label>蜂类：</label>
                <input id="flb" name="flb" class="easyui-validatebox" data-options="validType:'floatOrInt'" />
            </div>
             <div class="fitem">
                <label>其它天敌：</label>
                <input id="qttdb" name="qttdb" class="easyui-validatebox" data-options="validType:'floatOrInt'" />
            </div>
             <div class="fitem">
                <label>其它生防：</label>
                <input id="qtsfb" name="qtsfb" class="easyui-validatebox" data-options="validType:'floatOrInt'" />
            </div>
     <div class="fitem">
                <label>防生：</label>
                <input id="fsb" name="fsb" class="easyui-validatebox" data-options="validType:'floatOrInt'" />
            </div>
             <div class="fitem">
                <label>人工：</label>
                <input id="rgb" name="rgb" class="easyui-validatebox" data-options="validType:'floatOrInt'" />
            </div>
             <div class="fitem">
                <label>其它防治：</label>
                <input id="qtfzb" name="qtfzb" class="easyui-validatebox" data-options="validType:'floatOrInt'" />
            </div>
             <div class="fitem">
                <label>化防：</label>
                <input id="hfb" name="hfb" class="easyui-validatebox" data-options="validType:'floatOrInt'" />
            </div>
             <div class="fitem">
                <label>同病虫新防治：</label>
                <input id="tbcxfz" name="tbcxfz" class="easyui-validatebox" data-options="validType:'floatOrInt'" />
            </div>
             <div class="fitem">
                <label>无公害防治率：</label>
                <input id="wghfzrate" name="wghfzrate" class="easyui-validatebox" data-options="validType:'floatOrInt'" />
            </div>
             <div class="fitem">
                <label>防治率：</label>
                <input id="fzrate" name="fzrate" class="easyui-validatebox" data-options="validType:'floatOrInt'" />
            </div>
             <div class="fitem">
                <label>成灾面积：</label>
                <input id="czarea" name="czarea" class="easyui-validatebox" data-options="validType:'floatOrInt'" />
            </div>
             <div class="fitem">
                <label>挽回灾害面积：</label>
                <input id="whzharea" name="whzharea" class="easyui-validatebox" data-options="validType:'floatOrInt'" />
            </div>
             <div class="fitem">
                <label>成灾率：</label>
                <input id="czrate" name="czrate" class="easyui-validatebox" data-options="validType:'floatOrInt'" />
            </div>
             <div class="fitem">
                <label>防治费用：</label>
                <input id="fzfy" name="fzfy" class="easyui-validatebox" data-options="validType:'floatOrInt'" />
            </div>
             <div class="fitem">
                <label>死树株数：</label>
                <input id="sszs" name="sszs" class="easyui-validatebox" data-options="validType:'floatOrInt'" />
            </div>
             <div class="fitem">
                <label>真菌量：</label>
                <input id="zjl" name="zjl" class="easyui-validatebox" data-options="validType:'floatOrInt'" />
            </div>
             <div class="fitem">
                <label>细菌量：</label>
                <input id="xjl" name="xjl" class="easyui-validatebox" data-options="validType:'floatOrInt'" />
            </div>
             <div class="fitem">
                <label>病毒量：</label>
                <input id="bdl" name="bdl" class="easyui-validatebox" data-options="validType:'floatOrInt'" />
            </div>
             <div class="fitem">
                <label>天敌昆虫（万头）：</label>
                <input id="tdkc" name="tdkc" class="easyui-validatebox" data-options="validType:'floatOrInt'" />
            </div>
             <div class="fitem">
                <label>防生用量：</label>
                <input id="fsyl" name="fsyl" class="easyui-validatebox" data-options="validType:'floatOrInt'" />
            </div>
             <div class="fitem">
                <label>有机磷量：</label>
                <input id="yjll" name="yjll" class="easyui-validatebox" data-options="validType:'floatOrInt'" />
            </div>
             <div class="fitem">
                <label>菊脂类量：</label>
                <input id="jzll" name="jzll" class="easyui-validatebox" data-options="validType:'floatOrInt'" />
            </div>
             <div class="fitem">
                <label>烟剂量：</label>
                <input id="yjl" name="yjl" class="easyui-validatebox" data-options="validType:'floatOrInt'" />
            </div>
             <div class="fitem">
                <label>化学其它：</label>
                <input id="hxqt" name="hxqt" class="easyui-validatebox" data-options="validType:'floatOrInt'" />
                 <input name="otype" id="otype" type="hidden" />
                <input name="idstr" id="idstr" type="hidden" />
                <input id="key" name="key" onkeydown="if(event.keyCode==13)reloadgrid()" type="hidden" />
            </div>            

        </form>
    </div>
    <div id="dlg-buttons">
        
        <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-cancel'" onclick="javascript:$('#dlg').dialog('close')">关闭</a>
    </div>
    </div>
</asp:Content>


